const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin")
module.exports  = {
    mode:"development",
    module:{
        rules:[
            {
                test:/\.(jpg|png|gif)/,
                exclude:/node_modules/,
                use:[
                    {
                        loader:"url-loader",
                        options:{
                            //限制大小，小于5kb就转为base64
                            limit:5*1024,
                            //设置图片路径
                            name:"img/[name].[hash:6].[ext]"
                        }
                    }
                ]
            }
        ]
    },
    plugins:[
        new HtmlWebpackPlugin()
    ]
}